#include "zgraphicsdropshadoweffect.h"


ZGraphicsDropShadowEffect::ZGraphicsDropShadowEffect(QObject *parent)
    : QGraphicsDropShadowEffect{parent}
{

}

ZGraphicsDropShadowEffect::~ZGraphicsDropShadowEffect()
{

}

QRectF ZGraphicsDropShadowEffect::boundingRectFor(const QRectF &sourceRect) const
{
    return sourceRect;
}

void ZGraphicsDropShadowEffect::draw(QPainter *painter)
{
    QPoint offset;
    if (sourceIsPixmap()) {
//        // No point in drawing in device coordinates (pixmap will be scaled anyways).
        const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset);
        painter->drawPixmap(offset, pixmap);
    } else {
//        //Draw pixmap in device coordinates to avoid pixmap scaling;
        const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset);
        painter->setWorldTransform(QTransform());
        painter->drawPixmap(offset, pixmap);
    }
}

